﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="LCrs.Web.Main" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>聊城人事管理信息服务平台</title>
    <script src="Script/easyui/jquery.min.js"></script>
    <script src="Script/easyui/jquery.easyui.min.js"></script>
    <script src="Script/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script src="Script/changeEasyUITheme.js"></script>
    <link id="easyuiTheme" href="/Script/easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="Script/easyui/themes/icon.css" rel="stylesheet" />
    <%--<script src="Script/menu.js"></script>--%>
    <script src="Script/main.js"></script>
    <link href="CSS/default.css" rel="stylesheet" />
    <link href="CSS/list.css" rel="stylesheet" />
    <link href="CSS/IconExtension.css" rel="stylesheet" />
    <script type="text/javascript">
        var _menus = '';
        var theme;
        var myzu = "";
        var sprovince = "";
        var scity = "";
        var scounty = "";
        var level;
        var pt;
        var uid = "";
        var map;
        var data_info;
        var opts;

        Date.prototype.pattern = function (fmt) {
            var o = {
                "M+": this.getMonth() + 1, //月份        
                "d+": this.getDate(), //日        
                "h+": this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, //小时        
                "H+": this.getHours(), //小时        
                "m+": this.getMinutes(), //分        
                "s+": this.getSeconds(), //秒        
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度        
                "S": this.getMilliseconds() //毫秒        
            };
            var week = {
                "0": "/u65e5",
                "1": "/u4e00",
                "2": "/u4e8c",
                "3": "/u4e09",
                "4": "/u56db",
                "5": "/u4e94",
                "6": "/u516d"
            };
            if (/(y+)/.test(fmt)) {
                fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            }
            if (/(E+)/.test(fmt)) {
                fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "/u661f/u671f" : "/u5468") : "") + week[this.getDay() + ""]);
            }
            for (var k in o) {
                if (new RegExp("(" + k + ")").test(fmt)) {
                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                }
            }
            return fmt;
        }
        var Common = {

            //EasyUI用DataGrid用日期格式化
            TimeFormatter: function (value, rec, index) {
                if (value == undefined) {
                    return "";
                }
                /*json格式时间转js时间格式*/
                value = value.substr(1, value.length - 2);
                var obj = eval('(' + "{Date: new " + value + "}" + ')');
                var dateValue = obj["Date"];
                if (dateValue.getFullYear() < 1900) {
                    return "";
                }
                var val = dateValue.pattern("yyyy-MM-dd HH:mm");
                return val;
            },
            DateTimeFormatter: function (value, rec, index) {

                if (value == null || value == '') {
                    return '';
                }
                var dt;
                if (value instanceof Date) {
                    dt = value;
                }
                else {
                    dt = new Date(value);
                    if (isNaN(dt)) {
                        value = value.replace(/\/Date\((-?\d+)\)\//, '$1'); //标红的这段是关键代码，将那个长字符串的日期值转换成正常的JS日期格式
                        dt = new Date();
                        dt.setTime(value);
                    }
                }
                return dt.pattern("yyyy年M月d日");
            },

            //EasyUI用DataGrid用日期格式化
            DateFormatter: function (value, rec, index) {
                if (value == undefined) {
                    return "";
                }
                /*json格式时间转js时间格式*/
                value = value.substr(1, value.length - 2);
                var obj = eval('(' + "{Date: new " + value + "}" + ')');
                var dateValue = obj["Date"];
                if (dateValue.getFullYear() < 1900) {
                    return "";
                }

                return dateValue.pattern("yyyy-MM-dd");
            }
        };

        $(function () {
            $("#editpass").click(function () {
                $('#w').window('open');
            });
            $('#btnEp').click(function () {
                serverLogin();
            });
            $('#btnCancel').click(function () {
                closePwd();
            })
            $.ajax({
                url: "ashx/SysMenu.ashx?Method=GetMenuByUserID",
                dataType: 'text',
                type: "post",
                success: function (returnData) {
                    _menus = eval('(' + returnData + ')');
                    InitLeftMenu();
                }
            });
            $.ajax({
                type: "post",
                dataType: "json",
                url: "admin/getinfo.ashx?action=level",
                success: function aa(data) {
                    level = data[0].level;
                    var name = data[0].name;
                    var uadd = data[0].province + data[0].city + data[0].county + data[0].uadd;
                    $("#myinfos").text("用户名：" + name);

                }
            });

            tabClose();
            tabCloseEven();
            openPwd();
            $("#info").window("close");
            if ($.cookie('easyuiThemeName')) {
                changeThemeFun($.cookie('easyuiThemeName'));
                theme = $.cookie('easyuiThemeName');
            }
            $('#loginOut').click(function () {
                $.messager.confirm('系统提示', '您确定要退出本次登录吗?', function (r) {
                    if (r) {
                        location.href = 'loginout.aspx';
                    }
                });
            });
            $('#myinfo').click(function () {
                $.ajax({
                    type: "post",
                    dataType: "json",
                    url: "userinfo/GetUser.ashx?action=myinfo",
                    success: function aa(data) {
                        $("#uname").text(data.rows[0].uname);
                        $("#uprovince").text(data.rows[0].uprovince + data.rows[0].ucity + data.rows[0].ucounty);
                        $("#uunit").text(data.rows[0].uunit);
                        $("#utruename").val(data.rows[0].utruename);
                        $("#uphone").val(data.rows[0].uphone);
                        $("#uemail").val(data.rows[0].uemail);
                        $("#utel").val(data.rows[0].utel);
                        $("#uadd").val(data.rows[0].uadd);
                    }
                });
                $('#dlg').dialog('open').dialog('setTitle', '个人信息');
            });
            $('#dl').datagrid({
                title: '通知公告', //表格标题
                url: 'news/GetNews.ashx', //请求数据的页面
                sortName: 'newsTime', //排序字段
                idField: 'newsId', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度
                //height: $(parent.document).find("#mainPanle").height() - 35 > 0 ? $(parent.document).find("#mainPanle").height() - 35 : 500, //高度
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: true, //定义是否从服务器给数据排序
                fitColumns: true,
                singleSelect: true,
                method: 'post',
                columns: [[
                { title: '新闻标题', field: 'newsTitle', width: 80, sortable: true },
                {
                    title: '内容简介', field: 'newsContent', width: 100, formatter: function (value, row, index) {
                        return "<a href='#' onclick=showNews('" + row.newsId + "') style='color:blue' >" + subContent(row.newsContent) + "</a>";
                    }
                },
                { title: '发布时间', field: 'newsTime', width: 150 },
                { title: '作者', field: 'newsAuthor', width: 50 }

                ]],
                toolbar: "#tab_toolbar",
                queryParams: { "action": "query" },
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: 20, //默认一页数据条数
                rownumbers: true //行号
            });
        });
        function showNews(newsId) {

            $.ajax({
                type: "post",
                dataType: "json",
                url: "news/GetNews.ashx?action=querymodel&newsId="+newsId,
                success: function aa(data) {
                    //level = data[0].level;
                    //var name = data[0].name;
                    //var uadd = data[0].province + data[0].city + data[0].county + data[0].uadd;
                    //$("#myinfos").text("用户名：" + name);

                    $('#newsDig').dialog('open').dialog('setTitle', '通知公告');
                    //var t = data.rows[0].newsAuthor;
                    $('#newsAuthor').html(data.rows[0].newsAuthor);
                    $('#newsContent').html(data.rows[0].newsContent);
                    $('#newsTime').html(data.rows[0].newsTime);
                    $('#newsTitle').html(data.rows[0].newsTitle);
                    if (data.rows[0].newsUrl != "") {
                        $('#newsUrl').show();
                        $('#newsUrl').attr("href", "http://" + window.location.host + data.rows[0].newsUrl);
                    }
                    else {
                        $('#newsUrl').hide();
                    }
                    
                    //$('#test').html("http://"+window.location.host + data.rows[0].newsUrl);
                }
            });

         
        } 
        //截取字符串
        function subContent(str) {
            if (str.length > 20) {
                return str.substring(0, 19) + "...";
            }
            else {
                return str;
            }
        }
        function subTime(str) {
            return str.substring(0, str.lastIndexOf(" "))
        }
        function saveUser() {
            $('#fm').form('submit', {
                url: "userinfo/GetUser.ashx?action=updatemyinfo",
                onSubmit: function () {
                    return $(this).form('validate');
                },
                success: function (result) {
                    if (result.indexOf("T") == 0) {
                        $('#dlg').dialog('close');
                        $.messager.alert("提示", "恭喜您，信息修改成功", "info");
                    }
                    else if ((result.indexOf("F") == 0)) {
                        $.messager.alert("提示", "修改失败，请重新操作！", "info");
                        return;
                    }
                    else if ((result.indexOf("L") == 0)) {
                        $.messager.alert("提示", "长时间没有操作，请重新登录！", "info");
                        top.location = '/Default.aspx';
                        return;
                    }
                }
            });
        }
    </script>
    <style type="text/css">
        * {
            margin: 0px;
            padding: 0px;
            border: 0px;
        }

        #myul {
            width: 90%;
            height: 600px;
        }

            #myul li {
                list-style-type: none;
                float: left;
                width: 210px;
                text-align: center;
                margin: 5px;
            }

            #myul span {
                color: orange;
                font-size: 24px;
            }

            #myul img {
                border: 0px;
            }
            .datagrid-header {
            position: absolute; visibility: hidden;
            }
    </style>
</head>
<body class="easyui-layout" style="overflow-y: hidden" scroll="no">
    <noscript>
        <div style="position: absolute; z-index: 100000; height: 2046px; top: 0px; left: 0px; width: 100%; background: white; text-align: center;">
            <img src="images/noscript.gif" alt='抱歉，请开启脚本支持！' />
        </div>
    </noscript>
    <div region="north" border="false" style="overflow: hidden; height: 73px; background: url(images/top.jpg) #7f99be no-repeat; line-height: 20px; background-color: #336fad; color: #fff; font-family: Verdana, 微软雅黑,黑体">

        <span style="float: right; text-align: right; padding-right: 20px; margin-top: 15px;" class="head">
            <a href="#" id="mb" class="easyui-menubutton" data-options="menu:'#menu',iconCls:'icon-ok'">换肤</a>

            <a href="#" id="myinfo">个人信息</a> <a href="#" id="editpass">修改密码</a>
            <a href="#" id="loginOut">安全退出</a><br />
            欢迎 <span id="myinfos"></span></span>


        &nbsp;
    </div>
    <div region="south" style="height: 30px;">
        <div class="footer">聊城人事</div>
    </div>
    <div region="west" split="true" title="导航菜单" style="width: 180px;" id="west">
        <div class="easyui-accordion1" fit="true" border="false">
            <!--  导航内容 -->



        </div>

    </div>
    <div id="mainPanle" region="center" style="background: #eee; overflow-y: hidden">
        <div id="tabs" class="easyui-tabs" fit="true">
            <div title="欢迎使用" style="padding: 5px; overflow: hidden;" id="home">
                <div style="background: #ffffff; overflow: auto; height: 100%; width: 100%;">
                    <table id="dl" ></table>
                </div>

            </div>
        </div>
    </div>
    <div id="w" class="easyui-window" title="修改密码" collapsible="false" minimizable="false"
        maximizable="false" icon="icon-save" style="width: 300px; height: 150px; padding: 5px; background: #fafafa;">
        <div class="easyui-layout" fit="true">
            <div region="center" border="false" style="padding: 10px; background: #fff; border: 1px solid #ccc;">
                <table cellpadding="3">
                    <tr>
                        <td>旧密码：
                        </td>
                        <td>
                            <input id="OldPassword" name="OldPassword" type="Password" class="easyui-validatebox" required="true" />
                        </td>
                    </tr>

                    <tr>
                        <td>新密码：</td>
                        <td>
                            <input id="NewPassword" type="Password" class="txt01" /></td>
                    </tr>
                    <tr>
                        <td>确认密码：</td>
                        <td>
                            <input id="txtRePass" type="Password" class="txt01" /></td>
                    </tr>
                </table>
            </div>
            <div region="south" border="false" style="text-align: right; height: 40px; line-height: 30px;">
                <a id="btnEp" class="easyui-linkbutton" icon="icon-ok" href="javascript:void(0)">确定</a> <a id="btnCancel" class="easyui-linkbutton" icon="icon-cancel" href="javascript:void(0)">取消</a>
            </div>
        </div>
    </div>
     <div id="newsDig" class="easyui-dialog" style="width: 600px; height: 580px; padding: 2px"
        data-options="closed:true,buttons:'#dlg-buttons',shadow:false">
            <div id="mytt" class="easyui-tabs" style="width: 100%; height: 100%;">
                <div title="通知公告" class="myh" style="padding: 5px;">
                    <table>
                        <tr>
                            <td>标题：</td>
                            <td>
                                <span id="newsTitle" name="newsTitle" ></span>
                            </td>
                        </tr>
                        <tr>
                            <td>作者：</td>
                            <td>
                                <span id="newsAuthor" name="newsAuthor"  />
                             
                            </td>
                        </tr>
                         <tr>
                            <td>发布日期：</td>
                            <td>
                               <span id="newsTime" name="newsTime"/>
                            </td>
                        </tr>
                          <tr>
                            <td>附件下载：</td>
                            <td>
                               <a id="newsUrl" name="newsUrl" href="#" style="color:blue">附件下载</a>
                                <span id="test" name="test"/>
                            </td>
                        </tr>
                        <tr>
                            <td>内容：</td>
                            <td style="width:500px;height:500px;" >
                                <span id="newsContent" name="newsContent" style="word-wrap:break-word;word-break:keep-all;overflow:hidden;"  >

                                </span>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
    </div>
    <div id="menu" class="easyui-menu" style="width: 120px;">
        <div onclick="changeThemeFun('default')">Default</div>
        <div onclick="changeThemeFun('gray')">Gray</div>
        <div onclick="changeThemeFun('black')">Black</div>
        <div onclick="changeThemeFun('bootstrap')">bootstrap</div>
        <div onclick="changeThemeFun('metro')">metro</div>
        <div onclick="changeThemeFun('metro-blue')">metro-blue</div>
        <div onclick="changeThemeFun('metro-gray')">metro-gray</div>
        <div onclick="changeThemeFun('metro-green')">metro-green</div>
        <div onclick="changeThemeFun('metro-orange')">metro-orange</div>
        <div onclick="changeThemeFun('metro-red')">metro-red</div>
        <div onclick="changeThemeFun('ui-cupertino')">ui-cupertino</div>
        <div onclick="changeThemeFun('ui-dark-hive')">ui-dark-hive</div>
        <div onclick="changeThemeFun('ui-pepper-grinder')">ui-pepper-grinder</div>
        <div onclick="changeThemeFun('ui-sunny')">ui-sunny</div>

    </div>
    <div id="mm" class="easyui-menu" style="width: 150px;">
        <div id="mm-tabclose">关闭</div>
        <div id="mm-tabcloseall">全部关闭</div>
        <div id="mm-tabcloseother">除此之外全部关闭</div>
        <div class="menu-sep"></div>
        <div id="mm-tabcloseright">当前页右侧全部关闭</div>
        <div id="mm-tabcloseleft">当前页左侧全部关闭</div>
        <div class="menu-sep"></div>
        <div id="mm-exit">退出</div>
    </div>
    <div id="notity"></div>
</body>
</html>
